<?php

namespace app\service;
use think\Request;
use think\facade\Filesystem;
use think\facade\Log;
use app\controller\BaseController;
use app\model\Users;

class LoginService extends BaseController{

    public function login(Request $input){
        $userName=$input->param('userName','');
        $password=$input->param('password','');
        $result=Users::getUsersInfo($userName,$password);
        if(!$result){
            return $this->return_err(["msg"=>"登录失败"]);
        }
        if($result->username==$userName && $result->password==$password){
            return $this->return_succ([
                "data"=>[
                    "token"=>$result->id."_".date("YmdHis"),
                ]
            ]);
        }
        return $this->return_err(["msg"=>"登录失败"]);
    }



}
